import { createApp } from "vue"
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// import Auth from './plugins/auth-client'
import './assets/main.css'
import { JSEncrypt } from 'jsencrypt'
import { init } from '../src/api/config'

import App from "./App.vue"
import router from "./router"
// 按需注册element组件
import { registerElementComp } from '@/plugins/registerElement'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)
registerElementComp(app)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(createPinia())
app.use(router)
app.use(ElementPlus, { zIndex: 3000, locale: zhCn })
// app.use(Auth, router)
app.use(router)
init(app, router)
app.mount('#app')
